<?php
/**
 * Created by PhpStorm
 * User: 龍zero
 * Date: 2022-04-15
 * Time: 9:46
 */

namespace App\Controller\Cms;


use App\Controller\AbstractController;
use App\Service\FileService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\Filesystem\FilesystemFactory;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\PostMapping;
use League\Flysystem\Filesystem;

/**
 * @Controller(prefix="cms/file")
 * Class FileController
 * @package App\Controller\Cms
 */
class FileController extends AbstractController
{
    /**
     * @Inject()
     * @var FileService
     */
    private $fileService;

    /**
     * @PostMapping("")
     */
    public function upload(){
        $files = $this->request->getUploadedFiles();
        return $this->fileService->upload($files);
    }

    public function testType(){
//        var_dump($file->getFilename());
//        var_dump('--file--');
//        var_dump($file);
//        var_dump('--file_info--');
//        var_dump($file->getFileInfo());
//        var_dump('--path_info--');
//        var_dump($file->getPathInfo());
//        var_dump('--client_media_type--');
//        var_dump($file->getClientMediaType());
//        var_dump('--extension--');
//        var_dump($file->getExtension());
//        var_dump('--mime_type--');
//        var_dump($file->getMimeType());
//        var_dump('--type--');
//        var_dump($file->getType());
//        var_dump('--size--');
//        var_dump($file->getSize());
//        $this->fileService->upload($file);
    }
}